package com.prs.crm.domain.stock;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.ManyToOne;
import javax.persistence.OneToOne;
import javax.persistence.Table;

import com.prs.crm.domain.BaseEntity;
import com.prs.crm.domain.store.StoreRoom;

/**
 * 产品储藏室
 * 
 * 
 */
@Entity
@Table(name = "stock_productstore")
public class ProductStore extends BaseEntity {

	private static final long serialVersionUID = 1L;

	@Id
	@GeneratedValue(strategy = GenerationType.IDENTITY)
	private Integer id;

	@ManyToOne
	private StoreRoom room;

	@OneToOne
	private Product product;

	/**
	 * 库存数量
	 */
	private double productNum;

	private String storecode;
	
	/**
	 * 批号
	 */
	private String batchNum;
	/**
	 * 
	 * 调拨数量
	 */
	@Column(columnDefinition = "Integer(11) default '0'")
	private int flitNum;

	public int getFlitNum() {
		return flitNum;
	}

	public void setFlitNum(int flitNum) {
		this.flitNum = flitNum;
	}

	public Integer getId() {
		return id;
	}

	public void setId(Integer id) {
		this.id = id;
	}

	public StoreRoom getRoom() {
		return room;
	}

	public void setRoom(StoreRoom room) {
		this.room = room;
	}

	public Product getProduct() {
		return product;
	}

	public void setProduct(Product product) {
		this.product = product;
	}

	

	public double getProductNum() {
		return productNum;
	}

	public void setProductNum(double productNum) {
		this.productNum = productNum;
	}


	/**
	 * 入库数量添加
	 */
	public double addStoreinNum() {
		if (productNum == 0) {
			return this.productNum;
		} else {
			return (productNum + productNum);
		}
	}

	public String getBatchNum() {
		return batchNum;
	}

	public void setBatchNum(String batchNum) {
		this.batchNum = batchNum;
	}

	public String getStorecode() {
		return storecode;
	}


	public static long getSerialVersionUID() {
		return serialVersionUID;
	}

	public void setStorecode(String storecode) {
		this.storecode = storecode;
	}

	
}
